package com.ruoyi.project.web.safeRule.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.web.safeRule.mapper.SafeRuleMapper;
import com.ruoyi.project.web.safeRule.domain.SafeRule;
import com.ruoyi.project.web.safeRule.service.ISafeRuleService;
import com.ruoyi.common.utils.text.Convert;

/**
 * 安全细则Service业务层处理
 * 
 * @author ruoyi
 * @date 2021-01-28
 */
@Service
public class SafeRuleServiceImpl implements ISafeRuleService 
{
    @Autowired
    private SafeRuleMapper safeRuleMapper;

    /**
     * 查询安全细则
     * 
     * @param ruleId 安全细则ID
     * @return 安全细则
     */
    @Override
    public SafeRule selectSafeRuleById(Long ruleId)
    {
        return safeRuleMapper.selectSafeRuleById(ruleId);
    }

    /**
     * 查询安全细则列表
     * 
     * @param safeRule 安全细则
     * @return 安全细则
     */
    @Override
    public List<SafeRule> selectSafeRuleList(SafeRule safeRule)
    {
        return safeRuleMapper.selectSafeRuleList(safeRule);
    }

    /**
     * 新增安全细则
     * 
     * @param safeRule 安全细则
     * @return 结果
     */
    @Override
    public int insertSafeRule(SafeRule safeRule)
    {
        safeRule.setCreateTime(DateUtils.getNowDate());
        return safeRuleMapper.insertSafeRule(safeRule);
    }

    /**
     * 修改安全细则
     * 
     * @param safeRule 安全细则
     * @return 结果
     */
    @Override
    public int updateSafeRule(SafeRule safeRule)
    {
        return safeRuleMapper.updateSafeRule(safeRule);
    }

    /**
     * 删除安全细则对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteSafeRuleByIds(String ids)
    {
        return safeRuleMapper.deleteSafeRuleByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除安全细则信息
     * 
     * @param ruleId 安全细则ID
     * @return 结果
     */
    @Override
    public int deleteSafeRuleById(Long ruleId)
    {
        return safeRuleMapper.deleteSafeRuleById(ruleId);
    }
}
